<div class="_contro">
    <span style='font-size:2rem;margin-right:40rem'>共有 <span style='color:red'><?php echo count($face);?></span> 人参加本次活动</span>
    <?php if($end_time<time()){ ?>
    <span style='margin-right:1rem' id='Msg' ><a href="javascript:;">发送奖励短信</a> </span>
    <?php } ?>
    <!-- <select name="type" id="type">
        <option <?php if($type == 0){echo 'selected="selected"';}?> value="0">得分名次</option>
        <option <?php if($type == 1){echo 'selected="selected"';}?> value="1">参加时间</option>
    </select> -->
</div>
<div class='_cut'></div>
<div id='content'>
<?php foreach($face as $k=>$v){ ?>
<?php if($k%3==0){ ?>
<div class='row'>
    <?php }?>
    <div class='col-sm-3 col-md-4 full'>
        <div class='thumbnail' style="margin-bottom:10px">
            <div style="height:20rem;overflow: hidden">
                <img class='_img' src="<?php echo 'http://'.IMAGE_DOMAIN.''.$v['image']; ?>" style='width:100%;'/>
            </div>
        </div>
        <div class='caption' style='overflow: hidden'>
            <span style="margin-left: 6px"><?php echo $v['name']?></span>
            <span style="margin-left: 6px"><?php echo $v['mobile']?></span>
            <div >
                <span style="margin-left: 6px">参加时间：<?php echo date('Y-m-d',$v['create_time']);?></span>
                <span style="margin-left: 6px">得分：<?php echo $v['score'];?></span>
            </div>
        </div>
    </div>
    <?php if(($k+1)%3==0 || $face[$k+1]['id']<1){ ?>
</div>
<?php } ?>
<?php } ?>
</div>
<div class="clear"></div>
<script type='text/javascript'>
$(document).ready(function(){
   /* var number = 12;
    function loaddata()
    {
        if(number ==-1){
            return;
        }
        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());

        if ($(document).height() <= totalheight)
        {
            $.ajax({ url: "/home/action/appendDetail?start="+number,async:true, success: function(msg){
                    if(msg == 'false'){
                        number = -1;
                        return ;
                    }
                    var html = "";
                    msg = eval('(' + msg + ')');
                    $.each(msg,function(i,v){
                        if(i%3==0){
                            html += "<div class='row'>";
                        }
                        html += "<div class='col-sm-3 col-md-4 full'>";
                        html += "<div class='thumbnail' style='margin-bottom:10px'>";
                        html += "<div style='height:20rem;overflow: hidden'>";
                        html += "<img class='_img' src='";
                        html += v.image;
                        html += "' style='width:100%;'/></div></div><div class='caption'>";
                        html += '<div><span style="margin-left: 6px">参加时间：';
                        time = UnixToDate(v.create_time,8);
                        html += time;        
                        html += '</span><span style="margin-left: 6px">得分：';
                        html += v.score; 
                        html += "</span></div>";
                        if((i+1)%3==0){
                            html += "</div>";
                        }
                        number += 1;
                    });
                    $('#content').append(html);
            }});
        }
    }

    $(window).scroll(function () {
        loaddata();
    });*/
        /*$("#type").change(function(){
            var type = $("#type").val();
            setTimeout(window.location.href='/home/action/detail?type='+type);
        });*/
        $("#Msg").click(function(){
             var mobile = "<?php echo $mobile;?>";
             var action_id = "<?php echo $_GET['id']; ?>";
             if(confirm("是否确认发送短信")){
                $.ajax({url:"/home/action/sendMsg?mobile="+mobile+'&action_id='+action_id,async:true, 
                    success: function(msg){
                        if(msg==1){
                            alert("发送成功");
                        }
                        if(msg==0){
                            alert("发送失败");
                        }
                        if(msg==2){
                            alert('您已发送过短信');
                        }
                    }
                });
            }
        });
});
function UnixToDate(unixTime,timeZone) {
        if (typeof (timeZone) == 'number')
        {
          unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
        }
        var time = new Date(unixTime * 1000);
        var ymdhis = "";
        ymdhis += time.getUTCFullYear() + "-";
        ymdhis += (time.getUTCMonth()+1) + "-";
        ymdhis += time.getUTCDate();
        ymdhis += " " + time.getUTCHours() + ":";
        ymdhis += time.getUTCMinutes() + ":";
        ymdhis += time.getUTCSeconds();

        return ymdhis;
  }
</script>
